package trouger.dmt;

import java.util.Iterator;

import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;

/**
 * 
 * The interface whose implementation class instance should do the main logic process of the reduce phase,
 * accepting each record in a record group and collecting result records.
 * A record group is a set of records having the same key with each other.
 * 
 * @param <K> the map-output-key class, must implement {@link WritableComparable}
 * @param <V> the map-output-value class, must implement {@link Writable}
 */
interface ReducerEntity<K, V> {
	/**
	 * Accept a record group.
	 * A record group is a set of records having the same key with each other.
	 * 
	 * @param key the common key of all records in the record group.
	 * @param values iterator of all record values in the record group.
	 * @param recordOutputer a {@link RecordOutputer} implementation class instance used to output result records.
	 */
	public void acceptRecordGroup(K key, Iterator<V> values, RecordOutputer recordOutputer);
}
